# Copyright (C) 2020 Maxime Devos
# SPDX-License-Identifier: FSFAP
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I$(top_srcdir)/include

libexec_PROGRAMS = \
  rehash-service

rehash_service_CFLAGS = $(GNUNETUTIL_CFLAGS) $(GNUNETDATASTORE_CFLAGS) \
  $(GNUNETDHT_CFLAGS) -I$(top_srcdir)/include
rehash_service_LDFLAGS = $(GNUNETUTIL_LDFLAGS) $(GNUNETDATASTORE_LDFLAGS) \
  $(GNUNETDHT_LDFLAGS) -no-undefined
rehash_service_LDADD = $(GNUNETUTIL_LIBS) $(GNUNETDATASTORE_LIBS) \
  $(GNUNETDHT_LIBS) librehash.la
rehash_service_SOURCES = c-code/rehash-service.c c

# that's lib-rehash, not libre-hash
lib_LTLIBRARIES = librehash.la

# gnunet headers depend on libextractor headers

librehash_la_CFLAGS = $(GNUNETUTIL_CFLAGS) $(EXTRACTOR_CFLAGS)
librehash_la_LDFLAGS = $(GNUNETUTIL_LDFLAGS) -no-undefined
librehash_la_LIBADD = $(GNUNETUTIL_LIBS)
librehash_la_SOURCES = c-code/rehash-api.c \
  c-code/rehash_dht.c \
  c-code/rehash-crypto-from-data.c \
  c-code/rehash-crypto-to-data.c \
  c-code/rehash-crypto-from-hash.c

scheme-tests/nonetconf.conf: scheme-tests/nonetconf.conf.in
	$(SED) -e 's,[@]rehash_binary@,$(abs_builddir)/rehash-service,g' \
	  "$<" > "$@.tmp" && mv "$@.tmp" "$@"
